/**
 * 给按钮添加节流方法，在value内只能点击一次，默认5秒
 * */
export default {
  inserted(el, binding, vNode) {
    const value = binding.value || 5000
    el.addEventListener('click', function () {
      el.setAttribute('disabled', 'disabled')
      el.classList.add('is-disabled')
      setTimeout(function () {
        el.removeAttribute('disabled')
        el.classList.remove('is-disabled')
      }, value)
    })
  }
}
